package com.hzhr.iot.device.service;

import com.hzhr.iot.core.annotation.ApiImplicitInternalParams;
import com.hzhr.iot.core.annotation.CygQuery;
import com.hzhr.iot.core.annotation.CygQuerys;
import com.hzhr.iot.core.annotation.CygService;
import com.hzhr.iot.core.constant.CommonOptions;
import com.hzhr.iot.core.exception.ServiceException;
import com.hzhr.iot.core.util.HzhrDateUtil;
import com.hzhr.iot.core.util.HzhrTypeUtil;
import com.hzhr.iot.device.constant.DeviceOptions;
import com.hzhr.iot.device.constant.Device_ErrorsEnum;
import com.hzhr.iot.device.convertor.custom.DeviceMaintenanceCardItemCustomConvertor;
import com.hzhr.iot.device.dao.DeviceMaintenanceCardDao;
import com.hzhr.iot.device.dao.DeviceMaintenanceCardItemDao;
import com.hzhr.iot.device.entity.DeviceMaintenanceCardItemEntity;
import com.hzhr.iot.device.entity.ext.DeviceMaintenanceCardEntityExt;
import com.hzhr.iot.device.entity.ext.DeviceMaintenanceCardItemEntityExt;
import com.hzhr.iot.device.model.regulatorDevice_maintenanceCard_item.*;
import com.hzhr.iot.device.queryModel.custom.DeviceMaintenanceCardCustomQueryModel;
import com.hzhr.iot.device.queryModel.custom.DeviceMaintenanceCardItemCustomQueryModel;
import com.hzhr.iot.device.service.base.BaseService;
import com.hzhr.iot.login.sdk.model.userCard.UserCardModel;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import java.text.ParseException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;

@Service
@CygService(entity = DeviceMaintenanceCardItemEntity.class, model = RegulatorDevice_MaintenanceCard_ItemModel.class)
@CygQuerys({
        @CygQuery(name = "_equal_id", query = "equal_id", type = Integer.class),

})
public class RegulatorDevice_MaintenanceCard_ItemService extends BaseService {


    @Autowired
    DeviceMaintenanceCardItemDao deviceMaintenanceCardItemDao;

    @Autowired
    DeviceMaintenanceCardDao deviceMaintenanceCardDao;


    @Autowired
    DeviceOptions deviceOptions;


    @Autowired
    DeviceMaintenanceCardItemCustomConvertor deviceMaintenanceCardItemCustomConvertor;



    //region javadoc注释 : postByRegulatorDeviceIdAndMaintenanceCardId
    /**
     * 根据调压设备编号和维护卡编号创建该调压设备下维护卡的选项 <br/><br/>
     * 简介 : 根据调压设备编号和维护卡编号创建该调压设备下维护卡的选项 <br/>
     * 步骤 : <br/>
     * 1. 查询设备维护卡片 : <br/>
     *  根据路径参数regulatorDeviceId和maintenanceCardId查询设备卡片(DEVICE_MAINTENANCE_CARD)对象deviceMaintenance_1， <br/>
     *  路径参数筛选规则如下： <br/>
     *  (1) deviceMaintenance_1.deviceId = 路径参数regulatorDeviceId； <br/>
     *  (2) deviceMaintenance_1.id = 路径参数maintenanceCardId； <br/>
     * 如果deviceMaintenance_1不存在，抛出异常201； <br/>
     * 2. 创建维护卡片选项 : <br/>
     *  根据body创建维护卡片选项(DEVICE_MAINTENANCE_CARD_ITEM)对象deviceMaintenanceItem_1， <br/>
     *  额外属性设置规则如下： <br/>
     *  deviceMaintenanceItem_1.cardId = deviceMaintenance_1.id; <br/>
     * 3. 返回信息 : <br/>
     *  根据条件参数查询修改后的对象deviceMaintenanceItem_1的信息生成结果对象并返回； <br/>
     * @param header <br/>
     * _token : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 令牌;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : string;<br/>
     * _hzhr-user-id : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 用户编号;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : int;<br/>
     * _hzhr-user-code : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 用户代码;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : string;<br/>
     * _hzhr-user-name : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 用户名;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : string;<br/>
     * _hzhr-company-id : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 公司编号;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : int;<br/>
     * _hzhr-dept-id : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 部门编号;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : int;<br/>
     * _hzhr-user-type : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 用户类型(关联: common_service.options.code, typeCode = 'USER_TYPE');<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : string;<br/>
     * _hzhr-transaction-id : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 交易流水号;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : string;<br/>
     * _hzhr-transaction-type : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 交易类型;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : string;<br/>
     * _hzhr-access-mode : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 访问模式 0:一般 1:全局;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 默认值 : 0;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : int;<br/><br/>
     * @param query <br/>
     * _show : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 展示形式 one:展示一个,list:展示列表,null(空值):不展示;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : string;<br/>
     * _show_info : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 是否展示详情;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 默认值 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : boolean;<br/><br/>
     * @param regulatorDeviceId 调压设备编号 <br/><br/>
     * @param maintenanceCardId 维护卡编号 <br/><br/>
     * @param body <br/><br/>
     * @throws ServiceException <br/>
     * @see RegulatorDevice_MaintenanceCard_ItemPostModel body <br/>
     * @see RegulatorDevice_MaintenanceCard_ItemGetModel result <br/>
     */ 
    //endregion
    //region 说明 : postByRegulatorDeviceIdAndMaintenanceCardId
    //根据调压设备编号和维护卡编号创建该调压设备下维护卡的选项
    //简介 : 根据调压设备编号和维护卡编号创建该调压设备下维护卡的选项
    //步骤 :
    //1. 查询设备维护卡片 :
    // 根据路径参数regulatorDeviceId和maintenanceCardId查询设备卡片(DEVICE_MAINTENANCE_CARD)对象deviceMaintenance_1，
    // 路径参数筛选规则如下：
    // (1) deviceMaintenance_1.deviceId = 路径参数regulatorDeviceId；
    // (2) deviceMaintenance_1.id = 路径参数maintenanceCardId；
    //如果deviceMaintenance_1不存在，抛出异常201；
    //2. 创建维护卡片选项 :
    // 根据body创建维护卡片选项(DEVICE_MAINTENANCE_CARD_ITEM)对象deviceMaintenanceItem_1，
    // 额外属性设置规则如下：
    // deviceMaintenanceItem_1.cardId = deviceMaintenance_1.id;
    //3. 返回信息 :
    // 根据条件参数查询修改后的对象deviceMaintenanceItem_1的信息生成结果对象并返回；
    //endregion
    //region 参数 : postByRegulatorDeviceIdAndMaintenanceCardId
    @ApiImplicitParams({
            @ApiImplicitParam(name = "token", value = "令牌",required = true, dataType = "string", paramType = "header"),

            @ApiImplicitParam(name = "regulatorDeviceId", value = "调压设备编号",required = true, dataType = "int", paramType = "path"),
            @ApiImplicitParam(name = "maintenanceCardId", value = "维护卡编号",required = true, dataType = "int", paramType = "path"),

            @ApiImplicitParam(name = "show", value = "展示形式 one:展示一个,list:展示列表,null(空值):不展示", required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "show_info", value = "是否展示详情", defaultValue = "false", required = false, dataType = "boolean", paramType = "query"),

    })
    @ApiImplicitInternalParams({
            @ApiImplicitParam(name = "_token", value = "令牌",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-user-id", value = "用户编号",required = true, dataType = "int", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-user-code", value = "用户代码",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-user-name", value = "用户名",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-company-id", value = "公司编号",required = true, dataType = "int", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-dept-id", value = "部门编号",required = true, dataType = "int", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-user-type", value = "用户类型(关联: common_service.options.code, typeCode = 'USER_TYPE')",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-transaction-id", value = "交易流水号",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-transaction-type", value = "交易类型",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-access-mode", value = "访问模式 0:一般 1:全局",defaultValue = "0", required = false, dataType = "int", paramType = "header"),

            @ApiImplicitParam(name = "_show", value = "展示形式 one:展示一个,list:展示列表,null(空值):不展示", required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "_show_info", value = "是否展示详情", defaultValue = "false", required = false, dataType = "boolean", paramType = "query"),

    })
    //endregion
    //region 请求 : postByRegulatorDeviceIdAndMaintenanceCardId
    @RequestMapping(value = "/regulator-devices/{regulatorDeviceId}/maintenance-cards/{maintenanceCardId}/items", method = RequestMethod.POST)
    //endregion
    public RegulatorDevice_MaintenanceCard_ItemGetModel postByRegulatorDeviceIdAndMaintenanceCardId(Map<String, String> header, Integer regulatorDeviceId, Integer maintenanceCardId,
                                                                                                    Map<String, Object> query, RegulatorDevice_MaintenanceCard_ItemPostModel body) throws ServiceException, ParseException {
        //根据调压设备编号和维护卡编号创建该调压设备下维护卡的选项
        //简介 : 根据调压设备编号和维护卡编号创建该调压设备下维护卡的选项
        //步骤 :
        //1. 查询设备维护卡片 :
        // 根据路径参数regulatorDeviceId和maintenanceCardId查询设备卡片(DEVICE_MAINTENANCE_CARD)对象deviceMaintenance_1，
        // 路径参数筛选规则如下：
        // (1) deviceMaintenance_1.deviceId = 路径参数regulatorDeviceId；
        // (2) deviceMaintenance_1.id = 路径参数maintenanceCardId；
        //如果deviceMaintenance_1不存在，抛出异常201；
        UserCardModel userCard = getUserCard(header);
        DeviceMaintenanceCardCustomQueryModel queryModel = new DeviceMaintenanceCardCustomQueryModel();
        queryModel.setEqual_deviceId(regulatorDeviceId);
        queryModel.setEqual_id(maintenanceCardId);
        queryModel.setEqual_isValid("1");
        DeviceMaintenanceCardEntityExt deviceMaintenance_1 = deviceMaintenanceCardDao.selectExt(queryModel);
        if (deviceMaintenance_1 == null){
                throw new ServiceException(Device_ErrorsEnum.REGULATORDEVICE_MAINTENANCECARD_ITEM_SERVICE_POST_BY_REGULATOR_DEVICE_ID_AND_MAINTENANCE_CARD_ID_201);
        }

        //2. 创建维护卡片选项 :
        // 根据body创建维护卡片选项(DEVICE_MAINTENANCE_CARD_ITEM)对象deviceMaintenanceItem_1，
        // 额外属性设置规则如下：
        // deviceMaintenanceItem_1.cardId = deviceMaintenance_1.id;
        DeviceMaintenanceCardItemEntity deviceMaintenanceItem_1 = new DeviceMaintenanceCardItemEntity();
        //  float和double转换;不丢失精度 先转String,再转double

        String ds = HzhrTypeUtil.float2string(body.getRuningPressure());
        double d = HzhrTypeUtil.string2double(ds);
        deviceMaintenanceItem_1.setRuningPressure(d);


        String ds1 = HzhrTypeUtil.float2string(body.getMainClosePressure());
        double d2 = HzhrTypeUtil.string2double(ds1);
        deviceMaintenanceItem_1.setMainClosePressure(d2);

        String ds3 = HzhrTypeUtil.float2string(body.getSecondClosePressure());
        double d3 = HzhrTypeUtil.string2double(ds3);
        deviceMaintenanceItem_1.setSecondClosePressure(d3);


        String ds4 = HzhrTypeUtil.float2string(body.getOffPressure());
        double d4 = HzhrTypeUtil.string2double(ds4);
        deviceMaintenanceItem_1.setOffPressure(d4);

        String ds5 = HzhrTypeUtil.float2string(body.getEscapePressure());
        double d5 = HzhrTypeUtil.string2double(ds5);
        deviceMaintenanceItem_1.setEscapePressure(d5);

        deviceMaintenanceItem_1.setMaintenanceItem(body.getMaintenanceItem());
        deviceMaintenanceItem_1.setMaintenanceTime(HzhrDateUtil.timestamp2date(body.getMaintenanceTime()));
        deviceMaintenanceItem_1.setCardId(deviceMaintenance_1.getId());
        deviceMaintenanceItem_1.setCreateUserId(userCard.getUserId());

        deviceMaintenanceItem_1.setCreateTime(new Date());
        deviceMaintenanceItem_1.setIsValid(CommonOptions.YES_NO.YES);
        deviceMaintenanceItem_1.setState("1");

        int ChangeCount = deviceMaintenanceCardItemDao.insert(deviceMaintenanceItem_1);

        //3. 返回信息 :
        // 根据条件参数查询修改后的对象deviceMaintenanceItem_1的信息生成结果对象并返回；

        DeviceMaintenanceCardItemCustomQueryModel queryModel1 = new DeviceMaintenanceCardItemCustomQueryModel();
        queryModel1.setEqual_id(deviceMaintenanceItem_1.getId());
        Boolean showInfo = HzhrTypeUtil.object2boolean(query.get("_show_info"));
        if (showInfo != null && showInfo) {
            queryModel1.setShow(true);
        }
        DeviceMaintenanceCardItemEntityExt deviceMaintenanceItem_2 = null;
        String show = HzhrTypeUtil.object2string(query.get("_show"));
        if (show != null) {
            deviceMaintenanceItem_2 = deviceMaintenanceCardItemDao.selectExt(queryModel1);
        }

        List<DeviceMaintenanceCardItemEntityExt> list = new ArrayList<>();
        list.add(deviceMaintenanceItem_2);

        RegulatorDevice_MaintenanceCard_ItemGetModel result = deviceMaintenanceCardItemCustomConvertor.extList2regulatorDevice_MaintenanceCard_ItemGetModel(list,null,ChangeCount,query);
        result.setChangeCount(ChangeCount);
        return result;
    }

    //region javadoc注释 : deleteByRegulatorDeviceIdAndMaintenanceCardIdAndId
    /**
     * 根据调压设备编号和维护卡编号和维护卡选项编号删除调压设备下维护卡的选项 <br/><br/>
     * 简介 : 根据调压设备编号和维护卡编号和维护卡选项编号删除调压设备下维护卡的选项 <br/>
     * 步骤 : <br/>
     * 1. 删除维护卡片选项 : <br/>
     *  根据路径参数regulatorDeviceId、maintenanceCardId和id删除维护卡片选项(DEVICE_MAINTENANCE_CARD_ITEM)deviceMaintenanceItem_1， <br/>
     *  路径参数筛选规则如下： <br/>
     *  (1) deviceMaintenanceItem_1.id = 路径参数id； <br/>
     *  (2) deviceMaintenanceItem_1.cardId = 路径参数maintenanceCardId； <br/>
     *  (3) deviceMaintenanceItem_1.cardExt.deviceId = 路径参数regulatorDeviceId； <br/>
     * 2. 返回信息 : <br/>
     *  根据删除情况组装响应并返回结果 <br/>
     * @param header <br/>
     * _token : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 令牌;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : string;<br/>
     * _hzhr-user-id : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 用户编号;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : int;<br/>
     * _hzhr-user-code : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 用户代码;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : string;<br/>
     * _hzhr-user-name : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 用户名;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : string;<br/>
     * _hzhr-company-id : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 公司编号;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : int;<br/>
     * _hzhr-dept-id : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 部门编号;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : int;<br/>
     * _hzhr-user-type : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 用户类型(关联: common_service.options.code, typeCode = 'USER_TYPE');<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : string;<br/>
     * _hzhr-transaction-id : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 交易流水号;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : string;<br/>
     * _hzhr-transaction-type : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 交易类型;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : string;<br/>
     * _hzhr-access-mode : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 访问模式 0:一般 1:全局;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 默认值 : 0;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : int;<br/><br/>
     * @param query <br/><br/>
     * @param regulatorDeviceId 调压设备编号 <br/><br/>
     * @param maintenanceCardId 维护卡编号 <br/><br/>
     * @param id 维护卡的选项编号 <br/><br/>
     * @throws ServiceException <br/>
     * @see RegulatorDevice_MaintenanceCard_ItemDeleteModel result <br/>
     */ 
    //endregion
    //region 说明 : deleteByRegulatorDeviceIdAndMaintenanceCardIdAndId
    //根据调压设备编号和维护卡编号和维护卡选项编号删除调压设备下维护卡的选项
    //简介 : 根据调压设备编号和维护卡编号和维护卡选项编号删除调压设备下维护卡的选项
    //步骤 :
    //1. 删除维护卡片选项 :
    // 根据路径参数regulatorDeviceId、maintenanceCardId和id删除维护卡片选项(DEVICE_MAINTENANCE_CARD_ITEM)deviceMaintenanceItem_1，
    // 路径参数筛选规则如下：
    // (1) deviceMaintenanceItem_1.id = 路径参数id；
    // (2) deviceMaintenanceItem_1.cardId = 路径参数maintenanceCardId；
    // (3) deviceMaintenanceItem_1.cardExt.deviceId = 路径参数regulatorDeviceId；
    //2. 返回信息 :
    // 根据删除情况组装响应并返回结果
    //endregion
    //region 参数 : deleteByRegulatorDeviceIdAndMaintenanceCardIdAndId
    @ApiImplicitParams({
            @ApiImplicitParam(name = "token", value = "令牌",required = true, dataType = "string", paramType = "header"),

            @ApiImplicitParam(name = "regulatorDeviceId", value = "调压设备编号",required = true, dataType = "int", paramType = "path"),
            @ApiImplicitParam(name = "maintenanceCardId", value = "维护卡编号",required = true, dataType = "int", paramType = "path"),
            @ApiImplicitParam(name = "id", value = "维护卡的选项编号",required = true, dataType = "int", paramType = "path"),

    })
    @ApiImplicitInternalParams({
            @ApiImplicitParam(name = "_token", value = "令牌",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-user-id", value = "用户编号",required = true, dataType = "int", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-user-code", value = "用户代码",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-user-name", value = "用户名",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-company-id", value = "公司编号",required = true, dataType = "int", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-dept-id", value = "部门编号",required = true, dataType = "int", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-user-type", value = "用户类型(关联: common_service.options.code, typeCode = 'USER_TYPE')",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-transaction-id", value = "交易流水号",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-transaction-type", value = "交易类型",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-access-mode", value = "访问模式 0:一般 1:全局",defaultValue = "0", required = false, dataType = "int", paramType = "header"),

    })
    //endregion
    //region 请求 : deleteByRegulatorDeviceIdAndMaintenanceCardIdAndId
    @RequestMapping(value = "/regulator-devices/{regulatorDeviceId}/maintenance-cards/{maintenanceCardId}/items/{id}", method = RequestMethod.DELETE)
    //endregion
    public RegulatorDevice_MaintenanceCard_ItemDeleteModel deleteByRegulatorDeviceIdAndMaintenanceCardIdAndId(Map<String, String> header, Integer regulatorDeviceId,
                                                                                                           Integer maintenanceCardId, Integer id,
                                                                                                           Map<String, Object> query) throws ServiceException {
        //简介 : 根据调压设备编号和维护卡编号和维护卡选项编号删除调压设备下维护卡的选项
        //步骤 :
        //1. 删除维护卡片选项 :
        // 根据路径参数regulatorDeviceId、maintenanceCardId和id删除维护卡片选项(DEVICE_MAINTENANCE_CARD_ITEM)deviceMaintenanceItem_1，
        // 路径参数筛选规则如下：
        // (1) deviceMaintenanceItem_1.id = 路径参数id；
        // (2) deviceMaintenanceItem_1.cardId = 路径参数maintenanceCardId；
        // (3) deviceMaintenanceItem_1.cardExt.deviceId = 路径参数regulatorDeviceId；
        UserCardModel userCard = getUserCard(header);
        DeviceMaintenanceCardItemCustomQueryModel queryModel = new DeviceMaintenanceCardItemCustomQueryModel();
        queryModel.setEqual_id(id);
        queryModel.setEqual_cardId(maintenanceCardId);
        queryModel.setEqual_cardExt_deviceId(regulatorDeviceId);
        queryModel.setSet_isValid(CommonOptions.YES_NO.NO);
        queryModel.setSet_updateTime(new Date());
        queryModel.setSet_updateUserId(userCard.getUserId());
        int changeCount = deviceMaintenanceCardItemDao.updateProps(queryModel);

        //2. 返回信息 :
        // 根据删除情况组装响应并返回结果
        RegulatorDevice_MaintenanceCard_ItemDeleteModel result = new RegulatorDevice_MaintenanceCard_ItemDeleteModel();
        result.setChangeCount(changeCount);
        return result;
    }

    //region javadoc注释 : putByRegulatorDeviceIdAndMaintenanceCardIdAndId
    /**
     * 根据调压设备编号和维护卡编号和维护卡选项编号修改调压设备下维护卡的选项 <br/><br/>
     * 简介 : 根据调压设备编号和维护卡编号和维护卡选项编号修改调压设备下维护卡的选项 <br/>
     * 步骤 : <br/>
     * 1. 查询维护卡片选项： <br/>
     *  根据路径参数id查询维护卡片选项(DEVICE_MAINTENANCE_CARD_ITEM)对象deviceMaintenanceItem_1， <br/>
     *  路径参数筛选规则如下： <br/>
     *  (1) 对象deviceMaintenanceItem_1.id = 路径参数id； <br/>
     *  (2) 对象deviceMaintenanceItem_1.cardId = 路径参数maintenanceCardId； <br/>
     *  (3) 对象deviceMaintenanceItem_1.cardExt.deviceId = 路径参数regulatorDeviceId； <br/>
     *  如果deviceMaintenanceItem_1不存在，抛出异常201； <br/>
     * 2. 修改维护卡片选项 : <br/>
     *  根据body修改deviceMaintenanceItem_1； <br/>
     * 3. 返回信息 : <br/>
     *  根据条件参数查询修改后的对象deviceMaintenanceItem_1的信息生成结果对象并返回； <br/>
     * @param header <br/>
     * _token : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 令牌;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : string;<br/>
     * _hzhr-user-id : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 用户编号;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : int;<br/>
     * _hzhr-user-code : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 用户代码;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : string;<br/>
     * _hzhr-user-name : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 用户名;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : string;<br/>
     * _hzhr-company-id : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 公司编号;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : int;<br/>
     * _hzhr-dept-id : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 部门编号;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : int;<br/>
     * _hzhr-user-type : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 用户类型(关联: common_service.options.code, typeCode = 'USER_TYPE');<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : string;<br/>
     * _hzhr-transaction-id : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 交易流水号;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : string;<br/>
     * _hzhr-transaction-type : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 交易类型;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : string;<br/>
     * _hzhr-access-mode : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 访问模式 0:一般 1:全局;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 默认值 : 0;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : int;<br/><br/>
     * @param query <br/>
     * _show : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 展示形式 one:展示一个,list:展示列表,null(空值):不展示;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : string;<br/>
     * _show_info : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 是否展示详情;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 默认值 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : boolean;<br/><br/>
     * @param regulatorDeviceId 调压设备编号 <br/><br/>
     * @param maintenanceCardId 维护卡编号 <br/><br/>
     * @param id 维护卡的选项编号 <br/><br/>
     * @param body <br/><br/>
     * @throws ServiceException <br/>
     * @see RegulatorDevice_MaintenanceCard_ItemPutModel body <br/>
     * @see RegulatorDevice_MaintenanceCard_ItemGetModel result <br/>
     */ 
    //endregion
    //region 说明 : putByRegulatorDeviceIdAndMaintenanceCardIdAndId
    //根据调压设备编号和维护卡编号和维护卡选项编号修改调压设备下维护卡的选项
    //简介 : 根据调压设备编号和维护卡编号和维护卡选项编号修改调压设备下维护卡的选项
    //步骤 :
    //1. 查询维护卡片选项：
    // 根据路径参数id查询维护卡片选项(DEVICE_MAINTENANCE_CARD_ITEM)对象deviceMaintenanceItem_1，
    // 路径参数筛选规则如下：
    // (1) 对象deviceMaintenanceItem_1.id = 路径参数id；
    // (2) 对象deviceMaintenanceItem_1.cardId = 路径参数maintenanceCardId；
    // (3) 对象deviceMaintenanceItem_1.cardExt.deviceId = 路径参数regulatorDeviceId；
    // 如果deviceMaintenanceItem_1不存在，抛出异常201；
    //2. 修改维护卡片选项 :
    // 根据body修改deviceMaintenanceItem_1；
    //3. 返回信息 :
    // 根据条件参数查询修改后的对象deviceMaintenanceItem_1的信息生成结果对象并返回；
    //endregion
    //region 参数 : putByRegulatorDeviceIdAndMaintenanceCardIdAndId
    @ApiImplicitParams({
            @ApiImplicitParam(name = "token", value = "令牌",required = true, dataType = "string", paramType = "header"),

            @ApiImplicitParam(name = "regulatorDeviceId", value = "调压设备编号",required = true, dataType = "int", paramType = "path"),
            @ApiImplicitParam(name = "maintenanceCardId", value = "维护卡编号",required = true, dataType = "int", paramType = "path"),
            @ApiImplicitParam(name = "id", value = "维护卡的选项编号",required = true, dataType = "int", paramType = "path"),

            @ApiImplicitParam(name = "show", value = "展示形式 one:展示一个,list:展示列表,null(空值):不展示", required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "show_info", value = "是否展示详情", defaultValue = "false", required = false, dataType = "boolean", paramType = "query"),

    })
    @ApiImplicitInternalParams({
            @ApiImplicitParam(name = "_token", value = "令牌",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-user-id", value = "用户编号",required = true, dataType = "int", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-user-code", value = "用户代码",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-user-name", value = "用户名",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-company-id", value = "公司编号",required = true, dataType = "int", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-dept-id", value = "部门编号",required = true, dataType = "int", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-user-type", value = "用户类型(关联: common_service.options.code, typeCode = 'USER_TYPE')",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-transaction-id", value = "交易流水号",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-transaction-type", value = "交易类型",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-access-mode", value = "访问模式 0:一般 1:全局",defaultValue = "0", required = false, dataType = "int", paramType = "header"),

            @ApiImplicitParam(name = "_show", value = "展示形式 one:展示一个,list:展示列表,null(空值):不展示", required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "_show_info", value = "是否展示详情", defaultValue = "false", required = false, dataType = "boolean", paramType = "query"),

    })
    //endregion
    //region 请求 : putByRegulatorDeviceIdAndMaintenanceCardIdAndId
    @RequestMapping(value = "/regulator-devices/{regulatorDeviceId}/maintenance-cards/{maintenanceCardId}/items/{id}", method = RequestMethod.PUT)
    //endregion
    public RegulatorDevice_MaintenanceCard_ItemGetModel putByRegulatorDeviceIdAndMaintenanceCardIdAndId(Map<String, String> header, Integer regulatorDeviceId,
                                                                                                        Integer maintenanceCardId, Integer id,
                                                                                                        Map<String, Object> query, RegulatorDevice_MaintenanceCard_ItemPutModel body) throws ServiceException{
        //根据调压设备编号和维护卡编号和维护卡选项编号修改调压设备下维护卡的选项
        //简介 : 根据调压设备编号和维护卡编号和维护卡选项编号修改调压设备下维护卡的选项
        //步骤 :
        //1. 查询维护卡片选项：
        // 根据路径参数id查询维护卡片选项(DEVICE_MAINTENANCE_CARD_ITEM)对象deviceMaintenanceItem_1，
        // 路径参数筛选规则如下：
        // (1) 对象deviceMaintenanceItem_1.id = 路径参数id；
        // (2) 对象deviceMaintenanceItem_1.cardId = 路径参数maintenanceCardId；
        // (3) 对象deviceMaintenanceItem_1.cardExt.deviceId = 路径参数regulatorDeviceId；
        // 如果deviceMaintenanceItem_1不存在，抛出异常201；

        DeviceMaintenanceCardItemCustomQueryModel queryModel = new DeviceMaintenanceCardItemCustomQueryModel();
        queryModel.setEqual_id(id);
        queryModel.setEqual_cardId(maintenanceCardId);
        queryModel.setEqual_cardExt_deviceId(regulatorDeviceId);
        queryModel.setEqual_isValid("1");
        queryModel.setShow(true);
        DeviceMaintenanceCardItemEntityExt deviceMaintenanceItem_1 = deviceMaintenanceCardItemDao.selectExt(queryModel);
        if (deviceMaintenanceItem_1 == null){
            throw new ServiceException(Device_ErrorsEnum.REGULATORDEVICE_MAINTENANCECARD_ITEM_SERVICE_PUT_BY_REGULATOR_DEVICE_ID_AND_MAINTENANCE_CARD_ID_AND_ID_201);
        }

        //2. 修改维护卡片选项 :
        // 根据body修改deviceMaintenanceItem_1；

        //  float和double转换;不丢失精度
        String ds = HzhrTypeUtil.float2string(body.getRuningPressure());
        double d = HzhrTypeUtil.string2double(ds);
        deviceMaintenanceItem_1.setRuningPressure(d);


        String ds1 = HzhrTypeUtil.float2string(body.getMainClosePressure());
        double d2 = HzhrTypeUtil.string2double(ds1);
        deviceMaintenanceItem_1.setMainClosePressure(d2);

        String ds3 = HzhrTypeUtil.float2string(body.getSecondClosePressure());
        double d3 = HzhrTypeUtil.string2double(ds3);
        deviceMaintenanceItem_1.setSecondClosePressure(d3);


        String ds4 = HzhrTypeUtil.float2string(body.getOffPressure());
        double d4 = HzhrTypeUtil.string2double(ds4);
        deviceMaintenanceItem_1.setOffPressure(d4);

        String ds5 = HzhrTypeUtil.float2string(body.getEscapePressure());
        double d5 = HzhrTypeUtil.string2double(ds5);
        deviceMaintenanceItem_1.setEscapePressure(d5);

        deviceMaintenanceItem_1.setMaintenanceItem(body.getMaintenanceItem());
        deviceMaintenanceItem_1.setMaintenanceTime(HzhrDateUtil.timestamp2date(body.getMaintenanceTime()));
        int changeCount = deviceMaintenanceCardItemDao.update(deviceMaintenanceItem_1);

        //3. 返回信息 :
        // 根据条件参数查询修改后的对象deviceMaintenanceItem_1的信息生成结果对象并返回；
        DeviceMaintenanceCardItemEntityExt deviceMaintenanceCardItemEntityExt = null;
        DeviceMaintenanceCardItemCustomQueryModel queryModel1 = new DeviceMaintenanceCardItemCustomQueryModel();
        queryModel1.setEqual_id(deviceMaintenanceItem_1.getId());
        int total = deviceMaintenanceCardItemDao.selectCount(queryModel1);
        String show = HzhrTypeUtil.object2string(query.get("_show"));
        if (show != null) {
            deviceMaintenanceCardItemEntityExt = deviceMaintenanceCardItemDao.selectExt(queryModel1);
        }
        Boolean showInfo = HzhrTypeUtil.object2boolean(query.get("_show_info"));
        if (showInfo != null && showInfo){
            queryModel1.setShow(true);
        }

        List<DeviceMaintenanceCardItemEntityExt> list = new ArrayList<>();
        list.add(deviceMaintenanceCardItemEntityExt);

        RegulatorDevice_MaintenanceCard_ItemGetModel result = deviceMaintenanceCardItemCustomConvertor.extList2regulatorDevice_MaintenanceCard_ItemGetModel(list,total,changeCount,query);
        return result;
    }

    //region javadoc注释 : getByRegulatorDeviceIdAndMaintenanceCardId
    /**
     * 根据调压设备编号和维护卡编号查询该调压设备下维护卡的选项 <br/><br/>
     * 简介 : 根据调压设备编号和维护卡编号查询该调压设备下维护卡的选项 <br/>
     * 步骤 : <br/>
     * 1. 查询维护卡片选项 : <br/>
     *  根据条件参数以及路径参数regulatorDeviceId和maintenanceCardId查询设备卡片(DEVICE_MAINTENANCE_CARD_ITEM)对象集合deviceMaintenanceCardItemList_1， <br/>
     *  路径参数的筛选规则如下： <br/>
     *  (1) deviceMaintenanceCardItemList_1[i].cardExt.deviceId = 路径参数regulatorDeviceId； <br/>
     *  (2) deviceMaintenanceCardItemList_1[i].cardId = 路径参数maintenanceCardId； <br/>
     *  deviceMaintenanceCardItemList_1的排序规则如下： <br/>
     *  (1) 根据deviceMaintenanceCardItemList_1[i].maintenanceTime进行降序排序； <br/>
     * 2. 返回信息 : <br/>
     *  根据deviceMaintenanceCardItemList_1对象集合及条件参数生成结果对象并返回; <br/>
     * @param header <br/>
     * _token : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 令牌;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : string;<br/>
     * _hzhr-user-id : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 用户编号;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : int;<br/>
     * _hzhr-user-code : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 用户代码;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : string;<br/>
     * _hzhr-user-name : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 用户名;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : string;<br/>
     * _hzhr-company-id : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 公司编号;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : int;<br/>
     * _hzhr-dept-id : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 部门编号;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : int;<br/>
     * _hzhr-user-type : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 用户类型(关联: common_service.options.code, typeCode = 'USER_TYPE');<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : string;<br/>
     * _hzhr-transaction-id : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 交易流水号;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : string;<br/>
     * _hzhr-transaction-type : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 交易类型;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : true;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : string;<br/>
     * _hzhr-access-mode : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 访问模式 0:一般 1:全局;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 默认值 : 0;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : int;<br/><br/>
     * @param query <br/>
     * _show : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 展示形式 one:展示一个,list:展示列表,null(空值):不展示;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : string;<br/>
     * _show_total : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 是否展示总数;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 默认值 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : boolean;<br/>
     * _show_info : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 是否展示详情;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 默认值 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : boolean;<br/>
     * _page : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 页数;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 默认值 : 1;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : int;<br/>
     * _count : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 每页数量;<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 默认值 : 1;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : int;<br/>
     * _equal_id : <br/>&nbsp&nbsp&nbsp&nbsp 说明 : 筛选条件 : where sourceRegulaTorTank_maintenanceCard_item.id = #{_equal_id};<br/>&nbsp&nbsp&nbsp&nbsp 是否必填 : false;<br/>&nbsp&nbsp&nbsp&nbsp 数据类型 : int;<br/><br/>
     * @param regulatorDeviceId 调压设备编号 <br/><br/>
     * @param maintenanceCardId 维护卡编号 <br/><br/>
     * @throws ServiceException <br/>
     * @see RegulatorDevice_MaintenanceCard_ItemGetModel result <br/>
     */ 
    //endregion
    //region 说明 : getByRegulatorDeviceIdAndMaintenanceCardId
    //根据调压设备编号和维护卡编号查询该调压设备下维护卡的选项
    //简介 : 根据调压设备编号和维护卡编号查询该调压设备下维护卡的选项
    //步骤 :
    //1. 查询维护卡片选项 :
    // 根据条件参数以及路径参数regulatorDeviceId和maintenanceCardId查询设备卡片(DEVICE_MAINTENANCE_CARD_ITEM)对象集合deviceMaintenanceCardItemList_1，
    // 路径参数的筛选规则如下：
    // (1) deviceMaintenanceCardItemList_1[i].cardExt.deviceId = 路径参数regulatorDeviceId；
    // (2) deviceMaintenanceCardItemList_1[i].cardId = 路径参数maintenanceCardId；
    // deviceMaintenanceCardItemList_1的排序规则如下：
    // (1) 根据deviceMaintenanceCardItemList_1[i].maintenanceTime进行降序排序；
    //2. 返回信息 :
    // 根据deviceMaintenanceCardItemList_1对象集合及条件参数生成结果对象并返回;
    //endregion
    //region 参数 : getByRegulatorDeviceIdAndMaintenanceCardId
    @ApiImplicitParams({
            @ApiImplicitParam(name = "token", value = "令牌",required = true, dataType = "string", paramType = "header"),

            @ApiImplicitParam(name = "regulatorDeviceId", value = "调压设备编号",required = true, dataType = "int", paramType = "path"),
            @ApiImplicitParam(name = "maintenanceCardId", value = "维护卡编号",required = true, dataType = "int", paramType = "path"),

            @ApiImplicitParam(name = "show", value = "展示形式 one:展示一个,list:展示列表,null(空值):不展示", required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "show_total", value = "是否展示总数", defaultValue = "false", required = false, dataType = "boolean", paramType = "query"),
            @ApiImplicitParam(name = "show_info", value = "是否展示详情", defaultValue = "false", required = false, dataType = "boolean", paramType = "query"),
            @ApiImplicitParam(name = "page", value = "页数", defaultValue = "1",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "count", value = "每页数量", defaultValue = "1",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "equal_id", value = "筛选条件 : where sourceRegulaTorTank_maintenanceCard_item.id = #{equal_id}",required = false, dataType = "int", paramType = "query"),

    })
    @ApiImplicitInternalParams({
            @ApiImplicitParam(name = "_token", value = "令牌",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-user-id", value = "用户编号",required = true, dataType = "int", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-user-code", value = "用户代码",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-user-name", value = "用户名",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-company-id", value = "公司编号",required = true, dataType = "int", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-dept-id", value = "部门编号",required = true, dataType = "int", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-user-type", value = "用户类型(关联: common_service.options.code, typeCode = 'USER_TYPE')",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-transaction-id", value = "交易流水号",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-transaction-type", value = "交易类型",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-access-mode", value = "访问模式 0:一般 1:全局",defaultValue = "0", required = false, dataType = "int", paramType = "header"),

            @ApiImplicitParam(name = "_show", value = "展示形式 one:展示一个,list:展示列表,null(空值):不展示", required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "_show_total", value = "是否展示总数", defaultValue = "false", required = false, dataType = "boolean", paramType = "query"),
            @ApiImplicitParam(name = "_show_info", value = "是否展示详情", defaultValue = "false", required = false, dataType = "boolean", paramType = "query"),
            @ApiImplicitParam(name = "_page", value = "页数", defaultValue = "1",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "_count", value = "每页数量", defaultValue = "1",required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "_equal_id", value = "筛选条件 : where sourceRegulaTorTank_maintenanceCard_item.id = #{_equal_id}",required = false, dataType = "int", paramType = "query"),

    })
    //endregion
    //region 请求 : getByRegulatorDeviceIdAndMaintenanceCardId
    @RequestMapping(value = "/regulator-devices/{regulatorDeviceId}/maintenance-cards/{maintenanceCardId}/items", method = RequestMethod.GET)
    //endregion
    public RegulatorDevice_MaintenanceCard_ItemGetModel getByRegulatorDeviceIdAndMaintenanceCardId(Map<String, String> header, Integer regulatorDeviceId,
                                                                                                   Integer maintenanceCardId, Map<String, Object> query) throws ServiceException {

        //简介 : 根据调压设备编号和维护卡编号查询该调压设备下维护卡的选项
        //步骤 :
        //1. 查询维护卡片选项 :
        // 根据条件参数以及路径参数regulatorDeviceId和maintenanceCardId查询设备卡片(DEVICE_MAINTENANCE_CARD_ITEM)对象集合deviceMaintenanceCardItemList_1，
        // 路径参数的筛选规则如下：
        // (1) deviceMaintenanceCardItemList_1[i].cardExt.deviceId = 路径参数regulatorDeviceId；
        // (2) deviceMaintenanceCardItemList_1[i].cardId = 路径参数maintenanceCardId；
        // deviceMaintenanceCardItemList_1的排序规则如下：
        // (1) 根据deviceMaintenanceCardItemList_1[i].maintenanceTime进行降序排序；
        DeviceMaintenanceCardItemCustomQueryModel queryModel = deviceMaintenanceCardItemCustomConvertor.regulatorDevice_MaintenanceCard_ItemService_query2queryModel(query);
        queryModel.setEqual_cardExt_deviceId(regulatorDeviceId);
        queryModel.setEqual_cardId(maintenanceCardId);
        queryModel.setOrderBy_maintenanceTime("DESC");
        queryModel.setEqual_isValid(CommonOptions.YES_NO.YES);
        List<DeviceMaintenanceCardItemEntityExt> deviceMaintenanceCardItemList_1 = null;
        String show = HzhrTypeUtil.object2string(query.get("_show"));
        if (show != null) {
            deviceMaintenanceCardItemList_1= deviceMaintenanceCardItemDao.selectExtList(queryModel);
        }
        Boolean showTotal = HzhrTypeUtil.object2boolean(query.get("_show_total"));
        Integer total = null;
        if (showTotal != null && showTotal) {
            total = deviceMaintenanceCardItemDao.selectCount(queryModel);
        }

        //2. 返回信息 :
        // 根据deviceMaintenanceCardItemList_1对象集合及条件参数生成结果对象并返回;
        RegulatorDevice_MaintenanceCard_ItemGetModel result  = deviceMaintenanceCardItemCustomConvertor.extList2regulatorDevice_MaintenanceCard_ItemGetModel(deviceMaintenanceCardItemList_1, total,null,query);
        return result;
    }
}

